package com.macw;

import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.net.InetAddress;
import java.net.UnknownHostException;
/**
 *  微服务的优缺点：
 *  1。增加了运维部署的工作量与难度
 *  2。增加系统间调用逻辑的处理难度
 *  3。日志更难收集和统计了
 *  4。额外引入了一些非业务模块服务；
 *
 *  1。化繁为简，分散治理
 *  2。服务间松耦合，服务内高内聚
 *  3。服务可独立构建/部署/升级，局部更新
 *  4。提高系统容错性，减少系统整体崩溃概率
 *  5。易于实现异构系统
 */

/**
 * @author Administrator
 */
@SpringBootApplication
@EnableSwagger2
@MapperScan(basePackages = {"com.macw.ww_system.mapper","com.macw.ww_common.config"})
public class WwAdminApplication {
    public final static Logger log = LoggerFactory.getLogger(WwAdminApplication.class);

    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(WwAdminApplication.class, args);
        Environment env = applicationContext.getEnvironment();
        String ip = InetAddress.getLocalHost().getHostAddress();
        String port = env.getProperty("server.port");
        String path = env.getProperty("server.servlet.context-path");
        log.info("\n----------------------------------------------------------\n\t" +
                "Application  is running! Access URLs:\n\t" +
                "Local: \t\thttp://localhost:" + port + path + "\n\t" +
                "External: \thttp://" + ip + ":" + port + path + "\n\t" +
                "----------------------------------------------------------");
    }

}
